<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Register_success.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
        <%! static int i=0; %>
  <%
   String name2=request.getParameter("text_name");
   String word2=request.getParameter("text_pwd");
   String mibao=request.getParameter("mibao");
   Connection conn=null;
   Statement sm=null;
   ResultSet rs=null;
   
   String url="jdbc:mysql://127.0.0.1:3306/njyd?useUnicode=true&amp;characterEncoding=utf-8";
   
   Class.forName("com.mysql.jdbc.Driver");
   String user="root";
   String pwd="x5";
   conn=(Connection) DriverManager.getConnection(url,user,pwd);
   sm=(Statement) conn.createStatement();
   StringBuilder sb=new StringBuilder("insert into user(user.zhanghao,user.mima,user.mibao)values(name2,word2,mibao)");
   
   rs=(ResultSet) sm.executeQuery(sb.toString());
   while(rs.next()){
  	 int a=rs.getInt("id");
  	 String b=rs.getString("name");
  	 System.out.println("xu="+a+",name="+b);
   }
  rs.close();
  sm.close();
  conn.close();
   out.println("注册成功");
   %>
  </body>
</html>
